<?php

    class itScannerTest extends itTestCase {
        
        /**
         * @test
         */
        public function testStandalone() {
            $scanner = new itScanner();
            $result = $scanner->scanFile(TEST_DATA.'/Individual/LibUtil/Scanner/StandaloneClass.php');
            $this->assertTrue($result->hasClass('StandaloneClass'));
        }
        
        /**
         * @test
         * @depends testStandalone
         */
        public function testMultiple() {
            $scanner = new itScanner();
            $result = $scanner->scanFile(TEST_DATA.'/Individual/LibUtil/Scanner/MultipleClasses.php');
            $classes = $result->getClassArray();
            $this->assertEquals(3, count($classes['']));
            $interfaces = $result->getInterfaceArray();
            $this->assertEquals(2, count($interfaces['']));
        }
        
        /**
         * @test
         * @depends testMultiple
         */
        public function testReal() {
            $scanner = new itScanner();
            $result = $scanner->scanFile(TEST_DATA.'/Individual/LibUtil/Scanner/Real/TicketListener.php');
            $this->assertTrue($result->hasClass('PHPUnit_Extensions_TicketListener'));
        }
        
        /**
         * @test
         */
        public function testNamespaceVariations() {
            if ($this->cmpCurrentPHPVersion('5.3.0') < 0) {
                return;
            }
            
            $scanner = new itScanner();
            $result = $scanner->scanFile(TEST_DATA.'/Individual/LibUtil/Scanner/NamespaceVariations.php');
            $this->assertTrue($result->hasClass('MyNamespace\A'));
            $this->assertTrue($result->hasClass('MyNamespace\B'));
            $this->assertTrue($result->hasInterface('Rada\Rada'));
            $this->assertTrue($result->hasClass('A'));
            $this->assertTrue($result->hasClass('B'));
            $this->assertTrue($result->hasInterface('C'));
        }
        
        /**
         * @test
         * @depends testNamespaceVariations
         */
        public function testNamespaceVariations2() {
            if ($this->cmpCurrentPHPVersion('5.3.0') < 0) {
                return;
            }
            $scanner = new itScanner();
            $result = $scanner->scanFile(TEST_DATA.'/Individual/LibUtil/Scanner/NamespaceVariations2.php');
            $this->assertTrue($result->hasClass('MyNamespace\A'));
            $this->assertTrue($result->hasInterface('MyNamespace\B'));
            $this->assertTrue($result->hasInterface('MyNamespace\C'));
            $this->assertTrue($result->hasClass('MyNamespace2\A'));
            $this->assertTrue($result->hasClass('MyNamespace2\B'));
        }
        
        /**
         * @test
         * @depends testNamespaceVariations2
         */
        public function testRealNamespace() {
            if ($this->cmpCurrentPHPVersion('5.3.0') < 0) {
                return;
            }
            
            $scanner = new itScanner();
            $result = $scanner->scanFile(TEST_DATA.'/Individual/LibUtil/Scanner/Real/AuthActionsTest.php');
            $this->assertTrue($result->hasClass('Factity\AuthActionsTest'));
        }
    }
    
?>